<!DOCTYPE html>
<?php 
$sech="d1";
//判断是否进行了cookie进行设置
if(isset($_COOKIE["zhuti"])){
    $sech=$_COOKIE["zhuti"];
}
if(count($_POST)){
    echo "<br/>".$_POST["zhuti"];
    //设置cookie的有效期为一天
    setcookie("zhuti",$_POST["zhuti"],time()+3600*24);
    $sech=$_POST["zhuti"];
}
$a="style1";
?>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            .pink1{
                background-color: pink;
                color: green;
                size: 12px;
            }
            .skyblue1{
                background-color: skyblue;
                color: deepblue;
                size:24px;
            }
            .d1{
           
            }
            .<?php echo $a; ?>{
                
            }
        </style>
    </head>
    <body class="<?php echo $sech; ?>">
        <form action="cookie001.php" method="post">
            颜色主题:<select name="zhuti">
                <option value="pink1">粉色</option>
                <option value="skyblue1">天蓝色</option>
            </select>
            <br/>
            <input type="submit" value="提交"/>
        </form>
        <?php
        // put your code here
        ?>
    </body>
</html>
